<?php session_start();
	/* If someone try to go directly to this URL, redirect to index */
	if(!isset($_SESSION['participantSessionId']))
	{
		header("Location: http://".$_SERVER['SERVER_NAME']);
	}
	elseif(!isset($_SESSION['panas']))
	{
		header("Location: http://".$_SERVER['SERVER_NAME']."/participant.php");
	}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>

<body onload="document.onkeypress = manageKeyDown">
	<?php
		require_once("classes/MatrixColorsShapes.class.php");
		$matrix = new MatrixColorsShapes();
		$_SESSION['matrix'] = $matrix;
		//$matrix->debugMatrixList();
	?>
	<div id="page">
		<div id="left" class="centeredItem"></div>
		<div id="right" class="centeredItem"></div>
	</div>
    <div id="chrono" class="invisible"></div>
    <div>
    	<span id="count"><?php echo $matrix->actualStep; ?></span>/<span id="allSteps"><?php echo $matrix->stepsNumber; ?></span>
    </div>
    <input type="hidden" value="" id="shapeName">
    <script language="javascript" src="js/Timer.class.js"></script>
	<script language="javascript" src="js/graphics.js"></script>
    <script language="javascript" src="js/ajaxLoader.js"></script>
    <script>
		ajaxLoad("getRandomColoredName",null,createShapeFromXHR);
		window.onbeforeunload = function(){if(getCount() < getStepsNumber()) return 'Quitter au milieu du test ? Vos r�sultats ne seront pas valides !';};
	</script>
</body>
</html>